package com.zr.dao.impl;

import java.util.List;


import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.zr.dao.DeletePsjgDao;
import com.zr.model.Point;
import com.zr.model.Psjg;
@Repository("deletepsjgdao")
public class DeletePsjgDaoImpl extends BaseDaOImpl implements DeletePsjgDao{
	
	@Override
	public void deletePsjg(int[] pids) {
		System.out.println("-----");
		System.out.println(pids);
		for (int j = 0; j < pids.length; j++) {
		Point p = (Point) this.get(Point.class, Integer.valueOf(pids[j]));
		System.out.println(p);
		System.out.println("----");
		String pname = p.getPname();
		String hql = "from Psjg where pname=:pname";
		Query query= this.getCurrentSession().createQuery(hql);
		query.setString("pname", pname);
		List<Psjg> l = query.list();
		for (Psjg psfwb : l) {
			this.delete(psfwb);
		}
		}
	}

}
